@layout("/common/_container.html"){
<div class="row">
    <div class="col-sm-12">
        <div class="ibox float-e-margins">
            <div class="ibox-title">
                <h5>新闻资讯</h5>
            </div>
            <div class="ibox-content">
                <div class="row row-lg">
                    <div class="col-sm-12">
                        <div class="row">
                            <div class="col-sm-3">
                                <#NameCon id="condition" name="名称" />
                            </div>
                            <div class="col-sm-3">
                                <#button name="搜索" icon="fa-search" clickFun="News.search()"/>
                            </div>
                        </div>

                        <#table id="NewsTable"/>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>


<script >

    /**
     * 新闻资讯管理初始化
     */
    var News = {
        id: "NewsTable",	//表格id
        seItem: null,		//选中的条目
        table: null,
        layerIndex: -1
    };

    /**
     * 初始化表格的列
     */
    News.initColumn = function () {
        return [
            {field: 'selectItem', radio: true},
            {title: '资讯编号', field: 'id', visible: true, align: 'center', valign: 'middle'},
            {title: '资讯标题', field: 'title', visible: true, align: 'center', valign: 'middle'},
            {title: '新闻内容', field: 'content', visible: true, align: 'center', valign: 'middle'},
            {title: '创建时间', field: 'createTime', visible: true, align: 'center', valign: 'middle'},
            {title: '修改时间', field: 'modTime', visible: true, align: 'center', valign: 'middle'},
            {title: '编辑人', field: 'editor', visible: true, align: 'center', valign: 'middle'},
            {title: '面向人群的角色', field: 'roleid', visible: true, align: 'center', valign: 'middle'},
            {title: '阅读次数', field: 'readCount', visible: true, align: 'center', valign: 'middle'},
        ];
    };


    /**
     * 查询新闻资讯列表
     */
    News.query = function () {
        var newsParams = {};
        newsParams['condition'] = $("#condition").val();
        var defaultColunms = News.initColumn();
        var table = new BSTable(News.id, "/api/service/news/seclist", defaultColunms);
        table.setPaginationType("client");
        table.setQueryParams(newsParams);
        table.method = "GET";
        News.table = table.init();
        // News.table.refresh({query: queryData});
    };

    $(function () {
        var defaultColunms = News.initColumn();
        var table = new BSTable(News.id, "/api/service/news/list", defaultColunms);
        table.setPaginationType("client");
        News.table = table.init();
    });


</script>
@}
